package com.jackiechan.day12;

import java.io.File;

public class CountSize {
    public static void main(String[] args) {
        File file = new File("D:\\");
        System.out.println(file.getName()+"的长度:"+show(file));
    }
    public static long show(File file){
        long Size = 0;
        File[] files = file.listFiles();
        for (int i=0;i<files.length;i++){
            if (files[i].isFile()){
                Size+=files[i].length();
            }else if (files[i].isDirectory()){
                Size+=show(files[i]);
            }
        }
        return Size;

    }
}
